****SSRP figures ***This do file creates the figures for the SSRP P&P paper 

***RUN THIS CODE 
set graphics on 

****************GLOBALS***************
 

* Make globals for colors, from: https://blog.datawrapper.de/gendercolor/
global my_treatment_color "133 2 249" //purple for women
global my_control_color "0 196 170" //green for men


***Summarize the sample for the figure notes
bys el_T_Cmp_subject_teach_Eg: sum el_T_Cmp_Eg_pct_scored 
bys el_T_Cmp_subject_teach_Ma: sum el_T_Cmp_Ma_pct_scored 


****************FIGURES***************
twoway kdensity el_T_Cmp_Eg_pct_scored if el_T_Cmp_subject_teach_Eg==1, lcolor("$my_treatment_color") fcolor("$my_treatment_color %50") recast(area) || ///
kdensity el_T_Cmp_Eg_pct_scored if el_T_Cmp_subject_teach_Eg==0 , lcolor("$my_control_color") fcolor("$my_control_color %50") recast(area) ///
	title("English Content Knowledge") legend(ring(0) pos(10) order(1 2) region(lwidth(none)) label(1 "English Teachers") label(2 "Non-English Teachers")) ///
	xlabel(0(20)100) xtitle("English Content Knowledge (Percent)") ytitle("Density") ///
	name(english_pct, replace) xline(80)

twoway kdensity el_T_Cmp_Ma_pct_scored if el_T_Cmp_subject_teach_Ma==1, lcolor("$my_treatment_color") fcolor("$my_treatment_color %50") recast(area) || ///
kdensity el_T_Cmp_Ma_pct_scored if el_T_Cmp_subject_teach_Ma==0 , lcolor("$my_control_color") fcolor("$my_control_color %50") recast(area) ///
	title("Math Content Knowledge") legend(ring(0) pos(10) order(1 2) region(lwidth(none)) label(1 "Math Teachers") label(2 "Non-Math Teachers")) ///
	xlabel(0(20)100) xtitle("Math Content Knowledge (Percent)") ytitle("Density") ///
	name(math_pct, replace) xline(80) 




graph combine math_pct english_pct,  rows(2)
graph export "$outfig/figure1_kdensity_math_eng_uncondit.png",replace 
graph export "$outfig/figure1_kdensity_math_eng_uncondit.pdf",replace 



